<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<body>
<div class="ck_nr" th:fragment="transfer">
    <link rel="stylesheet"  href="css/public.css"/>
    <link rel="stylesheet" type="text/css" href="css/center.css"/>

    <div class="tk_nr zz_nr">
  <div class="tk_title" style="padding-top:10px; height:40px;">
    <h3>转账</h3>
    <span>产品钱包和产品钱包之间不能进行互转，请先转入中心钱包后再转到需要转入的产品钱包。(AG娱乐城和捕鱼王共用一个钱包)</span></div>

    <form id="transferForm">
  <div class="tk_box">
    <div class="zz_nr-pic"></div>
    <div class="tk_jr">
      <span class="text">转出钱包：</span><span class="input">
<select id="source-transfer" class="r_inptut inputwd300"  name="sourceTransfer">
<option value="main">中心钱包</option>
<option value="sb">体育</option>
<option value="keno">LB快乐彩</option>
<option value="grandsuite">金碧娱乐城</option>
<option value="aggame">AG娱乐城</option>
<option value="ptslot">PT老虎机</option>
</select>
</span>
    </div>
    <div class="tk_yh">
      <span class="text">转入钱包：</span><span class="input">
<select id="desc-transfer" class="r_inptut inputwd300" name="descTransfer">
<option value="main">中心钱包</option>
<option value="sportsbook">体育</option>
<option value="keno">LB快乐彩</option>
<option value="grandsuite">金碧娱乐城</option>
<option value="aggame">AG娱乐城</option>
<option value="ptslot">PT老虎机</option>
</select>
</span>
    </div>
    <div class="tk_yh"><span class="text">　　金额：</span> <span class="input">
<input name="transferAmount" type="number" id="transferMoney" placeholder="金额" class="r_inptut inputwd300"></span></div>
    <div>
      <button type="button" id="transfer_submit" class="as_but inputwd300">立即转账</button></div>
  </div>
    </form>
    <script>
        $("#transfer_submit").click(function () {
            var source = ($("#source-transfer option:selected").val());
            var sourceValue = ($("#source-transfer option:selected").text());
            var desctination =($("#desc-transfer option:selected").val());
            var desctinationValue =($("#desc-transfer option:selected").text());

            if(source == desctination ||  (source != 'main' && desctination!='main')){
              alertWorning('不能从'+sourceValue+"转入到"+desctinationValue);
              return;
            }

            var transferMoneyvalue = $("#transferMoney").val();
            if(transferMoneyvalue.length == 0){
                alertWorning('请输入您的转账金额!');
                return;
            }

            $.ajax({
                method: "POST",
                url: "/register",
                data: $("#transferForm").serializeArray(),
                dataType:'json'
            }).done(function( data ) {
                if(data.status =='success'){
                    window.location.href='/deposit';
                }else{
                    alertWorning( data.data );
                }
            });




        })

    </script>
</div>
</div>
</body>
</html>
